//
//  MagazineTableViewCell.m
//  HYHOME
//
//  Created by cjy on 16/3/3.
//  Copyright © 2016年 Mac. All rights reserved.
//

#import "MagazineTableViewCell.h"
#import "ModelS.h"
#import "UIImageView+WebCache.h"
@implementation MagazineTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.coverUrl = [[UIImageView alloc]init];
        [self.contentView addSubview:self.coverUrl];
        
        
        self.title = [[UILabel alloc]init];
        [self.coverUrl addSubview:self.title];
        
        [self.coverUrl release];
        [self.title release];
        
        
    }

    return self;



}

- (void)layoutSubviews{

    [super layoutSubviews];

    
    self.coverUrl.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 200);

    self.coverUrl.backgroundColor =[UIColor redColor];
    
    self.title.backgroundColor =  [UIColor colorWithRed:((arc4random()%(225 - 0 + 1) + 0)/225.f) green:((arc4random()%(225 - 0 + 1) + 0)/225.f) blue:((arc4random()%(225 - 0 + 1) + 0)/225.f) alpha:((arc4random()%(225 - 0 + 1) + 0)/225.f)];
    self.title.alpha = 0.8;
    self.title.frame = CGRectMake(0, self.contentView.frame.size.height - 35, self.contentView.frame.size.width, 30);
    
    

}
- (void)passModel:(ModelS *)model{

    [self.coverUrl sd_setImageWithURL:[NSURL URLWithString:model.coverUrl] placeholderImage:[UIImage imageNamed:@"jz"]];
    
    self.title.text = model.title;
    self.title.textColor = [UIColor whiteColor];
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
